sysroot: Correct error handling path in previous libglnx port
authorColin Walters <walters@verbum.org>
Mon, 30 May 2016 15:20:18 +0000 (11:20 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 30 May 2016 15:40:47 +0000 (15:40 +0000)
I happened to have the github page open with my commit after it was
merged, and then noticed a bug.

We still need to throw if we hit a non-`ENOENT` error.

Closes: #315
Approved by: giuseppe

src/libostree/ostree-sysroot.c

index bc8dde66f83f3f98b09a4e4280e0b26ce1f0eca7..8949f8f558afbc18726d02a93fbdea28c5dce0e2 100644 (file)
@@ -293,7 +293,12 @@ ostree_sysroot_ensure_initialized (OstreeSysroot  *self,
 
   if (fstatat (self->sysroot_fd, "ostree/repo/objects", &stbuf, 0) != 0)
     {
-      if (errno == ENOENT)
+      if (errno != ENOENT)
+        {
+          glnx_set_prefix_error_from_errno (error, "stat %s", "ostree/repo/objects");
+          goto out;
+        }
+      else
         {
           g_autoptr(GFile) repo_dir = g_file_resolve_relative_path (self->path, "ostree/repo");
           glnx_unref_object OstreeRepo *repo = ostree_repo_new (repo_dir);